package com.alstudio.net.protocol.xmpp;

import java.io.IOException;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.UnsupportedEncodingException;

import com.alstudio.utils.Mylog;

/**
 * XML-Writer
 * 
 * @version 1.0
 * @since 1.0
 */
public class XmlWriter {
	private OutputStreamWriter writer;

	
	private final String TAG = "XmlWriter";

	public XmlWriter(final OutputStream out) throws UnsupportedEncodingException {
		writer = new OutputStreamWriter(out, "UTF-8");
	}
	
	synchronized public void close() {
		try {
			writer.close();
		} catch (IOException e) {}
	}

	synchronized public void write(String str) throws IOException
	{
		writer.write(str);
		writer.flush();
		Mylog.d(TAG,"SEND: " + str);
	}
	
};
